/*------------------------------------------------------------------------------
*** PURPOSE: 	The following do-file generates Table 2 in the paper "Respondent 
				biases in household surveys" by Andrew Dillon and Edouard Romeo 
				Mensah. 

*** NOTE:		Relevant globals are defined in the do-file titles "master.do"
				contained in the folder "02_do" in the replication package.
------------------------------------------------------------------------------*/


	* Table 2. Treatment effects on crop portfolio.
	
	* Without unbalanced covariates and without gender interaction with treatment.
	* S.E. clustered at village-level: All villages included.
	
			eststo clear
			foreach i in $depvars2 {
				reg `i' i.treat1_hhead i.treat2_rproxy, vce(cluster village)
				qui sum `i' if e(sample) & treatarm==0
				local ctrlmean=r(mean)
				local ctrlsd=r(sd)
				testparm i.treat1_hhead i.treat2_rproxy
				local pvalue_all=r(p)
				lincom 1.treat1_hhead - 1.treat2_rproxy
				local Treat1_2_coef=r(estimate)
				local Treat1_2_t=r(estimate)/r(se)
				local Treat1_2_p= tprob(r(df),abs(`Treat1_2_t'))	
				eststo `i'_A, addscalars(pvalue_all `pvalue_all' Controlmean `ctrlmean' Controlsd `ctrlsd' ///
				Treat1_2_coef `Treat1_2_coef' Treat1_2_t `Treat1_2_t' pvalue_b1_b2 `Treat1_2_p')
			}
			
			
			
			esttab *_A using "04_output\Table 2. Treatment effects on crop portfolio.csv", se ///
			scalars("pvalue_b1_b2 p-value: test of T1=T2" "pvalue_all p-value: joint test of T1 and T2" N "Controlmean Control Mean" "Controlsd Control S.D.") sfmt(3 3 0 3 3) ///
			title("Table 2: Treatment effects on crop portfolio") ///
			mtitles("Cereals" "Legumes" "Vegetables" "Cash crops" "Crop diversity score") ///
			nonotes addnotes("All standard errors are clustered at the village level. *** p<0.01; ** p<0.05; * p<0.1." "Estimated without unbalanced covariates and without gender interaction with treatment.") star(* 0.1 ** 0.05 *** 0.01)  ///
			coeflabels(1.treat1_hhead "T1: HH Head" 1.treat2_rproxy "T2: Random Proxy") drop(0.treat1_hhead 0.treat2_rproxy _cons) ///
			b(3) se(3) noobs width(25) replace
			
			estimates clear
				
			
			
			